package com.drink.yan.web.rest;

import com.drink.yan.intf.entity.YanMasterSpecial;
import com.drink.yan.intf.vo.SchoolSpeTreeVo;
import com.drink.yan.intf.vo.YanMasterSpecialVo;
import com.drink.yan.svc.service.SpecialService;
import com.drink.yan.web.rest.req.qry.PageSchoolQry;
import com.drink.yan.web.rest.req.qry.ListMasterSpeQry;
import com.meta.framework.common.core.controller.BaseController;
import com.meta.framework.common.core.page.TableResponseVo;
import com.meta.framework.core.ResponseVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * java类简单作用描述
 *
 * @Title:
 * @Package: com.drink.yan.web.rest.app.
 * @Author: M.simple
 * @Remark: The modified content
 * @CreateDate: 2023/11/23 14:58
 * @Version: v2.0
 */
@RestController
@RequestMapping("/spe")
public class MasterSpeRest extends BaseController {

    @Resource
    private SpecialService specialService;


    @ApiOperation(value = "查询研究生院校招录专业类目", notes = "查询研究生院校招录专业类目", tags = {"学生小程序","PC"})
    @GetMapping("/list/category")
    public TableResponseVo<List<SchoolSpeTreeVo>> listSchoolSpeCategory(PageSchoolQry qry){
        startPage();
        List<SchoolSpeTreeVo> speTreeVos = specialService.listSchoolSpeCategory(qry);
        return getResponseVoTable(speTreeVos);
    }


    @ApiOperation(value = "查询本科院校招录专业类目", notes = "查询本科院校招录专业类目", tags = {"学生小程序","PC"})
    @GetMapping("/list/bachelor/category")
    public TableResponseVo<List<SchoolSpeTreeVo>> listBachelorSpeCategory(PageSchoolQry qry){
        startPage();
        List<SchoolSpeTreeVo> speTreeVos = specialService.listBachelorSpeCategory(qry);
        return getResponseVoTable(speTreeVos);
    }


    @ApiOperation(value = "查询专业", notes = "查询专业", tags = {"学生小程序","PC"})
    @GetMapping("/list")
    public TableResponseVo<List<YanMasterSpecialVo>> listMasterSpe(ListMasterSpeQry qry){
        startPage();
        List<YanMasterSpecialVo> list = specialService.listMasterSpe(qry);
        return getResponseVoTable(list);
    }

    @ApiOperation(value = "保存专业信息", notes = "保存专业信息", tags = {"PC"})
    @PostMapping("/save")
    public ResponseVo<YanMasterSpecial> save(@RequestBody YanMasterSpecial cmd){
        return ResponseVo.success(specialService.saveMasterSpe(cmd));
    }

    @ApiOperation(value = "专业详情", notes = "专业详情", tags = {"学生小程序"})
    @GetMapping("/detail/id/{specialId}")
    public ResponseVo<YanMasterSpecial> specialDetailById(@PathVariable Long specialId){
        return ResponseVo.success(specialService.specialDetail(specialId));
    }


    @ApiOperation(value = "专业详情", notes = "专业详情", tags = {"学生小程序"})
    @GetMapping("/detail/code/{specialCode}")
    public ResponseVo<YanMasterSpecial> specialDetail(@PathVariable String specialCode){
        return ResponseVo.success(specialService.specialDetail(specialCode));
    }


}
